//求子串是否符合回文字符串

function find(str) {

    if (str.length == 1) {
        return 0;
    }
    let res = []; //符合的数组

    //切割子串
    let arr = str.split('');
    let i = 0;
    while (i < arr.length) {
        arr.splice(0, 1);
        let son = arr;
        let temp = [son[0]];
        for (let j = 1; j < son.length; j++) {
            const element = son[j];
            temp.push(element);
            // console.log(temp, 'temp');
            if (check(temp)) {
                res.push(temp.join(''));
            }
        }
    }

    if (res.length == 0) {
        return 0;
    }
    // console.log(res);
    // return res.join(',');
    return res.length;

}

//判断回文
function check(arr) {
    if (arr.length == 1 || arr.length == 0) {
        return false;
    }
    for (let i = 0; i < arr.length / 2; i++) {
        if (arr[i] !== arr[arr.length - 1 - i]) {
            return false;
        }
    }
    return true;
}
console.log(check(['a', 'c', 'a', 'a']));
console.log(find('abbcbb'));